package com.atguigu.gmall.realtime.app.dws.func;

import com.atguigu.gmall.realtime.util.KeywordUtil;
import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;

import java.util.List;

@FunctionHint(output = @DataTypeHint("ROW<keyword STRING>"))
public   class KeywordFunction  extends TableFunction<Row> {

    public void eval(String fullword) {

        List<String> keywordList = KeywordUtil.analyzeKeyword(fullword);
        for (String keyword : keywordList) {
            collect(Row.of(keyword));

        }
    }
}
